<template>
	<view>
		<uni-card :title="userInfo.nickname" :sub-title="userInfo.city" :thumbnail="userInfo.avatar" note="Tips">
		</uni-card>
		<uni-list>
			<uni-list-item title="我的任务" link @click="toggleTaskListVisible"></uni-list-item>
<!-- 			<uni-list v-if="showTaskList === true">
				<uni-list-item note="任务1" link to="/pages/my/taskDetail"></uni-list-item>
				<uni-list-item note="任务2" link to="/pages/my/taskDetail"></uni-list-item>
			</uni-list> -->
			<uni-list-item title="设置" link to="/pages/my/set"></uni-list-item>
		</uni-list>
		<view class="foot-bar">
			<button type="primary" size="mini" id="shareButton" open-type="share">分享</button>
		</view>
	</view>
</template>

<script setup>
import { onShareAppMessage } from '@dcloudio/uni-app'
import { ref, getCurrentInstance } from 'vue'
import { useUserStore } from '../../stores/user.js'

const userStore = useUserStore()
const avatar = ref("https://qiniu-web-assets.dcloud.net.cn/unidoc/zh/unicloudlogo.png")
const showTaskList = ref(false)
const instance = getCurrentInstance()
const userInfo = userStore.userInfo

const toggleTaskListVisible = () => {
	// showTaskList.value = !showTaskList.value
	uni.navigateTo({
		url: '/pages/my/investList'
	})
}

onShareAppMessage(res => {
	if (res.from === 'button') {
		return {
			title: '你也来试试吧',
			imageUrl: avatar.value
		}
	}
})
</script>

<style scoped lang="scss">
.foot-bar {
	margin-top: .2rem;
	text-align: center;
}
</style>
